package shapes.shapes2D.curves 
{
	import flash.geom.Point;
	/**
	 * @author Nicolas Barradeau
	 * http://en.nicoptere.net
	 */
	public class Spiral
	{
		
		static public function compute( x:Number = 0, y:Number = 0, step:Number = 10, radiusStep:Number = 1, maxIteration:int = 100 ):Vector.<Point>
		{
			
			var points:Vector.<Point> = Vector.<Point>( [ new Point( x, y ) ] );
			
			var radian:Number = Math.PI / 180;
			var radius:Number = 0;
			var theta:Number = 0;
			
			var inc:int = 0;
			while (inc < maxIteration )
			{
			   
				theta = inc * step * radian;
				radius = inc * radiusStep;
				
				points.push( new Point(	x + Math.cos( theta ) * radius, 
										y + Math.sin( theta ) * radius	) );
										
				inc++;
				
			}
			
			return points;
		}
		
	}

}